#include "image.h"
#include "surface.h"

// resouce manager
#include "resman/resman.h"


#include "util/log.h"				// log
#include "util/common_macros.h"		// macros
#include "util/mmgr.h"		    

#include <cassert>

Image::Image() : 
	m_Width(256), m_Height(256), m_pSurf(NULL)
{

}

Image::~Image()
{
}

bool    Image::Load(const std::string& _File)
{
    m_File = _File;
	m_pSurf = (Surface*) res::ResMan::Instance().GetResource(_File);
	if (m_pSurf) 
	{
		m_Width = m_pSurf->GetWidth();
		m_Height = m_pSurf->GetHeight();
		return true; 
	}
	else 
		return false;
}

bool    Image::SetTextureStage(unsigned int _TexStage)
{
    if (m_pSurf)
    {
        if(!m_pSurf->SetTextureStage(_TexStage))
			return false;
    }
	return true;
}

unsigned int Image::GetSortVal()
{
	return (unsigned int)((size_t)m_pSurf);
}
